#include "queue.h"

void select_menu();
void menu();

queue* p;
queue* temp;
int judge=1;
int  main(){
	while(judge){
		menu();
		select_menu();
	}
	return 0;
}
void select_menu(){	
	printf("请选择：");
	int select=0;
	scanf("%d",&select);
	switch(select){
		case 0:
			 judge=0;
			 clear_queue(p);
			 break;	
		case 1:
			 p=init_queue();
			 if(p!=NULL){
				printf("初始化成功！\n");
			 }
			 break;
		case 2:
				data_t data=0;
				printf("data=");
				scanf("%d",&data);
				int i=push(p,data);
				if(i>0){
					printf("添加成功! \n");
					disp_queue(p);
				}else{
					printf("请先初始化！\n");
				}
			 break;
		case 3:
			 pop(p);
			 disp_queue(p);
			 break;
		case 4:
		 if(isInit(p)){
				printf("请先初始化！\n");
			 }
			 disp_queue(p);
			 break;
		default:
			printf("输入错误！");
	}
}
void menu(){
	printf("--------------\n");
	printf("0:退出\n");
	printf("1:初始化stack\n");
	printf("2:push\n");
	printf("3:pop \n");
	printf("4:遍历\n");
	printf("--------------\n");
}
